import java.lang.reflect.Array;

/**
 * @author dragon
 * @version 1.0
 * @description 通过反射来创建数组
 * @date created in 2018-11-06
 */
public class Test5 {

    public static void main(String[] args) {
        Person[] o = (Person[]) Array.newInstance(Person.class, 10);
        System.out.println(o.length);
        Person person = new Person("dragon", 12);
        o[0] = person;
        Person student = new Student();
        o[1] = student;
        System.out.println(o[0].getName() + "  " + o[0].getAge());
        Array.set(o, 0, new Person("dragon21wersadf", 1234));
        System.out.println(o[0].getName());
        Integer[] array = new Integer[19];
        System.out.println(array.getClass().getComponentType());
    }
}
